package com.aron;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.awt.*;

/**
 * @version v1.0
 * @ProjectName: studycoding
 * @ClassName: TankBlast
 * @Description: TODO(一句话描述该类的功能)
 * @Author: Leo
 * @Date: 2020/6/14 17:35
 */
public class TankBlast {
    private static Logger logger = LoggerFactory.getLogger(Missile.class);
    //X，Y轴
    private int x, y;
    //宽高
    private int width, height;

    //帧数
    private int step = 0;
    //是否存活
    private boolean isLive = true;

    public TankBlast(int x, int y) {
        this.x = x;
        this.y = y;

        this.width = ResourseMgr.tankBlasts[0].getWidth();
        this.height = ResourseMgr.tankBlasts[0].getHeight();

    }

    public boolean isLive() {
        return isLive;
    }

    public void setLive(boolean live) {
        isLive = live;
    }

    public void print(Graphics g) {
        if(!this.isLive())return;
        g.drawImage(ResourseMgr.tankBlasts[step], x, y, null);
        step++;
        if (step >= ResourseMgr.tankBlasts.length) {
            this.die();
            // step=0;
        }
    }

    private void die() {
        this.setLive(false);
    }


}
